"""
拖拽操作
"""
import time

from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains

url="http://sahitest.com/demo/dragDropMooTools.htm"
driver = webdriver.Chrome()
driver.maximize_window()
driver.get(url=url)
driver.implicitly_wait(10)

drag_el=driver.find_element(By.XPATH,"//*[@id='dragger']")
el1=driver.find_element(By.XPATH,"/html/body/div[2]")
el2=driver.find_element(By.XPATH,"/html/body/div[3]")
el3=driver.find_element(By.XPATH,"/html/body/div[4]")
time.sleep(3)
#直接元素A拖拽到元素B
#ActionChains(driver).drag_and_drop(drag_el,el1).perform()
ac=ActionChains(driver)
#长按释放
#ac.click_and_hold(drag_el).release(el2).persorm()
#长按-移动-释放
ac.click_and_hold(drag_el).move_to_element(el3).release().perform()